export const Layout = () => import('@/layout/index.vue')

import component from 'virtual:svg-icons-register'
import type { App } from 'vue'
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'

// 静态路由
export const constantRoutes: RouteRecordRaw[] = [
	{
		path: '/',
		redirect: '/illegal/alarm',
	},
	{
		path: '/illegal/alarm',
		component: () => import('@/views/illegal/alarm/index.vue'),
		meta: { hidden: true },
	},
	{
		path: '/401',
		component: () => import('@/views/error-page/401.vue'),
		meta: { hidden: true },
	},
	{
		path: '/illegal/charts',
		component: () => import('@/views/illegal/charts/index.vue'),
		meta: { hidden: true },
	},
	// {
	// 	path: '/',
	// 	redirect: '/illegal',
	// },
	// {
	// 	path: '/illegal',
	// 	name: '/illegal',
	// 	// component: () => import('@/views/illegal/index.vue'),
	// 	redirect: '/illegal/alarm',
	// 	children: [
	// 		{
	// 			path: '/alarm',
	// 			name: 'alarm',
	// 			component: () => import('@/views/illegal/alarm/index.vue'),
	// 		},
	// 	],
	// },
]

const router = createRouter({
	history: createWebHashHistory(),
	routes: constantRoutes,
	scrollBehavior: () => ({ top: 0, left: 0 }),
})

export function setupRouter(app: App<Element>) {
	app.use(router)
}
export default router
